{include file="public/header" /}
<body>
<div class="layui-card">
    <div class="layui-card-body">
        <div class="layui-tab-content">
            <blockquote class="layui-elem-quote">
                带 <span class="x-red">*</span> 为必填项
            </blockquote>
            <form id="userForm" class="layui-form layui-form-pane" autocomplete="off">
                <div class="layui-form-item">
                    <label class="layui-form-label layui-required">姓名</label>
                    <div class="layui-input-block">
                        <input type="text" name="name" id="realName" placeholder="请输入姓名" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-required">用户名</label>
                    <div class="layui-input-block">
                        <input type="text" name="username" id="username" placeholder="请输入用户名" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-required">密码</label>
                    <div class="layui-input-block">
                        <input type="password" name="password" id="password" placeholder="密码长度为6至20位" class="layui-input">
                    </div>
                    <!--<div class="layui-form-mid layui-word-aux">为空则不修改密码</div>-->
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-required">确认密码</label>
                    <div class="layui-input-block">
                        <input type="password" name="repassword" id="rePassword" placeholder="请再次输入密码" class="layui-input">
                    </div>
                    <!--<div class="layui-form-mid layui-word-aux">为空则不修改密码</div>-->
                </div>
                <div class="btn-block">
                    <button type="button" onclick="sendUserForm()" class="layui-btn layui-btn-normal"><i class="fa fa-check"></i>提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary"><i class="fa fa-refresh"></i>重置</button>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
<script>
    layui.use('form',function () {
        var form = layui.form;

    });

    function sendUserForm() {
        let data = $("#userForm").serialize();
        ajaxRequest("{:url('user/add')}",data,function (res) {
            if (res.code == 'suc'){
                sucMsg(res.msg,function () {
                    parent.layui.table.reload('userList')
                    xadmin.close()
                })
            }else {
                errMsg(res.msg)
            }

        })
    }
</script>
</html>